package org.example.day20240819;

import java.util.Scanner;

public class Main2 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        scanner.nextLine();
        String line = scanner.nextLine();
        String[] arr = line.split(" ");
        FenShu result = new FenShu(0,1);
        for (int i=0; i< arr.length; i++){
            String fenshuStr = arr[i];
            String[] fennshuArr = fenshuStr.split("/");
            FenShu fenShu = new FenShu(Long.parseLong(fennshuArr[0]),Long.parseLong(fennshuArr[1]));
            result = result.add(fenShu);
            result.simple();
        }
        if(result.isOver(String.valueOf(result))){
            System.out.println(String.valueOf(result).substring(0,1));
        }else {
            System.out.println(result);
        }
    }
}
